package com.ZeroCarbon.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 返回结果封装
 *
 * @since 2024-10-7
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    /*
     * 是否成功
     * */
    private Boolean success;

    /*
     * 错误信息
     * */
    private String errorMsg;

    /*
     * 数据
     * */
    private Object data;

    public static Result success() {
        return new Result(true, null, null);
    }

    public static Result success(Object data) {
        return new Result(true, null, data);
    }

    public static Result error(String errorMsg) {
        return new Result(false, errorMsg, null);
    }
}
